<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>auto cheyun cms</title>

    <link href="<?php echo base_url(); ?>static/css/bootstrap.min.css" rel="stylesheet">
    <link href="<?php echo base_url(); ?>static/font-awesome/css/font-awesome.css" rel="stylesheet">
    <link href="<?php echo base_url(); ?>static/css/animate.css" rel="stylesheet">
    <link href="<?php echo base_url(); ?>static/css/plugins/summernote/summernote.css" rel="stylesheet">
    <link href="<?php echo base_url(); ?>static/css/plugins/summernote/summernote-bs3.css" rel="stylesheet">
    <link href="<?php echo base_url(); ?>static/css/style.css" rel="stylesheet">

    <!-- 导入jquery -->
    <script src="<?php echo base_url(); ?>static/js/jquery-2.1.1.js"></script>

</head>

<body>
	
	<div id="wrapper">
		<!-- 左侧菜单 -->
		<?php $this->load->view('admin/common/left.html'); ?>
		<div id="page-wrapper" class="gray-bg">
			<!-- 公共头部 -->
			<?php $this->load->view('admin/common/header.html'); ?>
			<!-- content 主区域 -->
			<div class="wrapper wrapper-content">
	            <div class="row">
	                <div class="col-lg-12">
		                <div class="ibox float-e-margins">
			                <div class="ibox-title">
								<h5>添加账号</h5>
							</div>
                            <?php if ($this->session->has_userdata('error')): ?>
                                <div class="alert alert-danger alert-dismissable">
                                    <button aria-hidden="true" data-dismiss="alert" class="close" type="button">×</button>
                                    <?php echo $this->session->tempdata('error'); ?> 
                                </div>
                            <?php endif ?>
							<div class="ibox-content">
								<form method="post" class="form-horizontal" id="user">
									<div class="form-group"><label class="col-sm-1 control-label">用户名</label>
                                    	<div class="col-sm-3"><input type="text" class="form-control" name="username" value="<?php echo set_value('username', isset($user['username'])?$user['username']:'') ?>"></div>
                                	</div>
                                	<div class="hr-line-dashed"></div>
									<div class="form-group"><label class="col-sm-1 control-label">密码</label>
                                    	<div class="col-sm-3"><input type="password" class="form-control" name="password" value="<?php echo set_value('password', isset($user['password'])? $user['password'] : '') ?>"></div>
                                	</div>
                                	<div class="hr-line-dashed"></div>
                                    <div class="form-group"><label class="col-sm-1 control-label">确认密码</label>
                                        <div class="col-sm-3"><input type="password" class="form-control" name="repassword" value="<?php echo set_value('repassword', isset($user['password'])? $user['password'] : '') ?>"></div>
                                    </div>
                                    <div class="hr-line-dashed"></div>
                                	<div class="form-group"><label class="col-sm-1 control-label">所属组</label>
                                    	<div class="col-sm-3">
                                        <select class="form-control m-b" name="gid">
                                            <option value="0">---选择组---</option>
                                            <?php foreach ($roles as $role): ?>
                                                 <option <?php echo set_select('gid', $role['id'], isset($user['gid']) && $role['id']==$user['gid']?true:false) ?> value="<?php echo $role['id'] ?>"><?php echo $role['title'] ?></option>
                                            <?php endforeach ?>
                                        </select>
                                        </div>
                                	</div>
                                	<div class="hr-line-dashed"></div>
                                	
									<div class="form-group">
	                                    <div class="col-sm-4 col-sm-offset-2">
	                                        <button class="btn btn-primary" type="submit">保存</button>
	                                    </div>
	                                </div>
								</form>
							</div>
		                </div>
		            </div>
	            </div>
			</div>
            <?php $this->load->view('admin/common/footer.html'); ?>

		</div>
	</div>


    <!-- Mainly scripts -->
    <script src="<?php echo base_url(); ?>static/js/jquery-2.1.1.js"></script>
    <script src="<?php echo base_url(); ?>static/js/bootstrap.min.js"></script>
    <script src="<?php echo base_url(); ?>static/js/plugins/metisMenu/jquery.metisMenu.js"></script>
    <script src="<?php echo base_url(); ?>static/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>

    <!-- Custom and plugin javascript -->
    <script src="<?php echo base_url(); ?>static/js/inspinia.js"></script>
    <script src="<?php echo base_url(); ?>static/js/plugins/pace/pace.min.js"></script>

    <!-- Jquery Validate -->
    <script src="<?php echo base_url(); ?>static/js/plugins/validate/jquery.validate.min.js"></script>
	    <script>
         $(document).ready(function(){

             $("#user").validate({
                 rules: {
                 	 username: {
                 		required: true,	
                 	 },
                     password: {
                         required: true,
                     },
                     repassword: {
                         required: true,
                     },
                     gid:{
                        required: true,
                        min:1
                     }

                 }
             });
        });
    </script>
</body>